// packageA/mycomponent/invitation/invitation.js
Component({
  /**
	 * 组件的属性列表
	 */
  properties: {
    prop_goods_info: {
      type: null
    },
    tabList: {
      type: null
    },
    min_micro: {
      type: null
    },
    roomdata: {
      type: null
    },
    knowledgeList: {
      type: null
    },
  },
  lifetimes: {
    attached() {
      this.setData({
        showPop: false,
      });
    }
  },
  observers: {
    tabList(tabList) {
      if (tabList.length > 0) {
        console.log(tabList);
        this.setData({
          isPost: tabList[0].id
        });
      }
    }
  },
  /**
	 * 组件的初始数据
	 */
  data: {
    isPost: 1,
    currentIndex: 0,

    showPop: false,
    micro_communities: [],
    page: 1,
    last_page: 1,
    knowledgeOption: {
      article_name: 'title',
      base_name: 'has_one_yz_supply_knowledge_base.title',
      // created_at: 'release_time_at'
    }
  },

  /**
	 * 组件的方法列表
	 */
  methods: {
    changeTab(e) {
      this.setData({
        currentIndex: 0,
        isPost: e.detail.name
      });
    },
    swiperChange(e) {
      this.setData({
        currentIndex: e.detail.current
      });
    },
    //直播间跳转
    gopage(e) {
      let status = e.currentTarget.dataset.status;
      let id = e.currentTarget.dataset.id;
      let backid = e.currentTarget.dataset.backid;
      if (status == 1) {
        wx.navigateTo({
          url: "/packageD/directSeeding/livePage/livePage?id=" + id + "&playerType=live",
        });
      } else if (status == 2) {
        wx.navigateTo({
          url: "/packageD/directSeeding/livePage/livePage?id=" + id + "&playerType=video" + "&backid=" + backid,
        });
      } else if (status == 3) {
        wx.navigateTo({
          url: "/packageD/directSeeding/foreshow/foreshow?id=" + id,
        });
      }
    },
    tapShow() {
      if(this.data.isPost==1){
        wx.navigateTo({
          url: '/packageA/others/GoodsComment/GoodsComment?gid=' + this.data.prop_goods_info.get_goods.id + '&istype=micro',
        });
      }
      if(this.data.isPost==3){
        wx.navigateTo({
          url: '/packageI/knowledge/knowledgeSearch/knowledgeSearch?plu=project-template-good&gid=' + this.data.prop_goods_info.get_goods.id
        });
      }
    },
    goMicro(e) {
      let id = e.currentTarget.dataset.id;
      wx.navigateTo({
        url: '/packageC/micro_communities/microCommentDetails/microCommentDetails?stickId=' + id,
      });
    },
    closeShow() {
      this.setData({
        showPop: false
      });
    },
    onListClick(e){
      let {id,base_id,knowledge_base_id} = e.detail;
      wx.navigateTo({
        url: `/packageI/knowledge/knowledgeDetail/knowledgeDetail?id=${id}&bid=${base_id||knowledge_base_id}&plu=project-template`,
      });
    }
  }
});